﻿using System;

namespace DesignPattern.Prototype
{
    /// <summary>
    /// the interface of prototype
    /// </summary>
    public interface IPrototype
    {
        /// <summary>
        /// copy self and return the copy
        /// </summary>
        IPrototype Clone();
    }

    /// <summary>
    /// 
    /// </summary>
    public class ConcretePrototype : IPrototype
    {
        public ConcretePrototype(ConcretePrototype prototype)
        {
        }

        public IPrototype Clone()
        {
            return new ConcretePrototype(this);
        }
    }

    /// <summary>
    /// The example for run Prototype mode
    /// </summary>
    public class Client
    {
        private IPrototype m_prototype;

        public Client(IPrototype prototype)
        {
            m_prototype = prototype;
        }

        public void Process()
        {
            IPrototype newPrototype = m_prototype.Clone();
        }
    }
}
